package com.yc.cloud.admin.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import lombok.val;
import io.swagger.annotations.*;

import java.util.List;

import com.yc.cloud.basic.api.CommonPage;
import com.yc.cloud.basic.api.ResponseResult;
import com.yc.cloud.basic.dto.BaseQueryParam;
    import org.springframework.web.bind.annotation.RestController;
import com.yc.cloud.admin.service.AvatarsSettingService;
import com.yc.cloud.entity.AvatarsSetting;
import javax.annotation.Resource;

/**
 * 数字人设置
 * @author Yancy
 * @date 2024-04-10
 */
@RestController
@RequestMapping("/avatars-setting")
@Api(value = "数字人设置", tags = "数字人设置接口")
    public class AvatarsSettingController {

@Resource
private  AvatarsSettingService avatarsSettingService;


@GetMapping
@ApiOperation(value = "数字人设置列表", notes = "支持分页查询,字段模糊匹配,排序等")
public ResponseResult<CommonPage<AvatarsSetting>>list(BaseQueryParam param){
        val result= avatarsSettingService.list(param);
        return ResponseResult.success(CommonPage.restPage(result));
        }


@GetMapping("{id}")
@ApiOperation(value = "数字人设置详情", notes = "根据ID查询")
public ResponseResult<AvatarsSetting> get(@PathVariable @ApiParam(value = "ID", required = true) Long id){
          val result = avatarsSettingService.get(id);
         return ResponseResult.success(result);
        }


@PostMapping
@ApiOperation(value = "添加数字人设置", notes = "添加")
public ResponseResult<AvatarsSetting> create(@Validated @RequestBody AvatarsSetting param){
        val result= avatarsSettingService.create(param);
        return result!=null?ResponseResult.success(result):ResponseResult.failed();
        }


@ApiOperation(value = "删除数字人设置", notes = "通过ID删除")
@DeleteMapping(value = "{id}")
public ResponseResult<Boolean> delete(@PathVariable @ApiParam(value = "ID", required = true) Long id){
        val result= avatarsSettingService.delete(id);
        return result?ResponseResult.success(true):ResponseResult.failed();
        }


                                                

@ApiOperation(value = "修改数字人设置", notes = "通过ID修改")
@PutMapping(value = "{id}")
public ResponseResult<AvatarsSetting> update(@PathVariable @ApiParam(value = "ID", required = true) Long id,@Validated @RequestBody AvatarsSetting param){
        val result= avatarsSettingService.update(id,param);
        return result!=null?ResponseResult.success(result):ResponseResult.failed();
        }
        }
